'use strict';

module.exports = app => {
  const { INTEGER, DATE, TEXT } = app.Sequelize;

  const Roleresource = app.model.define('roleresource', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    resource_array: TEXT, // 资源ID 编号数组
    role_id: INTEGER,
    created_at: DATE,
    updated_at: DATE,
  });

  Roleresource.associate = function() {
    app.model.Roleresource.belongsTo(app.model.Role, { foreignKey: 'roleId' });
  };

  return Roleresource;
};
